import service from "../utils/request";

export const getUserListAll = (params: any) => {
    return service.get("/nttboot/sys/user/listAll", {params});
  };

export const addUser = (params: any) => {
  return service.post("/nttboot/sys/user/add", params);
};

export const editUser = (params: any) => {
  return service.post("/nttboot/sys/user/edit", params);
};

// 冻结/解冻
export const putUserFrozen = (params: any) => {
  return service.put("/nttboot/sys/user/frozenBatch", params);
};

//验证邮箱是否存在
export const checkEmail = (params: any) => {
  return service.get("/nttboot/sys/duplicate/check", {params});
};

//删除
  export const deleteUser = (params: any) => {
    return service.delete("/nttboot/sys/user/delete", {params});
  };

//批量删除
export const deleteUserBatch = (params: any) => {
  const userIdsString = params.ids.join(',');
  return service.delete(`/nttboot/sys/user/deleteBatch?ids=${userIdsString}`, {
    data: params
  });
};

//修改密码
export const changePassword = (params: any) => {
  return service.put("/nttboot/sys/user/changePassword", params);
};

// 获取角色列表
export const getRoleList = (params: any) => {
  return service.get("/nttboot/sys/role/queryallNoByTenant", {params});
};

//查询用户有哪些角色
export const queryUserRole = (params: any) => {
  return service.get("/nttboot/sys/user/queryUserRole", {params});
};